#include "stdafx.h"
#include "Menu.h"
#include "UiElement.h"

#include "..\..\..\..\EdgeGraphics\HUD.h"
#include "..\..\..\..\EdgeGameCore\SettingsManager.h"
#include "..\..\..\..\EdgeGraphics\Texture2D.h"

/*virtual*/ Menu::~Menu(void)
{
	for (unsigned int i = 0; i < elements.size(); i++)
		delete elements[i];
}

/*virtual*/ void Menu::Update(float dt) /*override*/
{
	for (unsigned int i = 0; i < elements.size(); i++)
		elements[i]->Update(dt);
}

/*virtual*/ void Menu::Draw(void) /*override*/
{
	if (background)
	{
		Hud* pHud = Hud::GetInstance();
		SettingsManager* pSettings = SettingsManager::GetInstance();

		pHud->DrawRectangle(0, 0, pSettings->getSetting("ScreenWidth")._int, pSettings->getSetting("ScreenHeight")._int, background);
	}
	for (unsigned int i = 0; i < elements.size(); i++)
		elements[i]->Draw();
}